|
In-Circuit Debugger |
|
|
2. The Hardware |
|
2.1. Processor |
The ICD is containing a PIC itself running at 20MHz clock. Depending of your spare box's contents, you can either take a PIC16F876 (28 pins, picture at right) or the larger PIC 16F877 (40 pins). The PIC's digital I/O pins connects to the serial interface (RC6-7, RB4-5) and the target processor (RC0-5). Further, the analog inputs RA0, RA1 and RA3 are used to measure the voltage levels of Target's MCLR, Vdd and Vpp.
|
|
2.2. Serial Interface |
As RS-232 Transceiver, a common MAX232 in standard application is used. If you take a MAX232A instead, replace the 1uF capacitors by 0.1uF ones. To the 9 pin female SUB-D connector establishing the connection to the COM-port, there is also a resistor and a zener diode connected for generating a reset signal (might be omitted...).
|
|
2.3. Supply Voltages |
For seldom home use it seems good to take one power supply delivering the progamming voltage Vpp (+13V) and derive from that Vdd (+5V) via a 7805 voltage regulator. So we can adjust the Vpp if necessary, too. You could also take +5V (eg. from USB or the target board) and use a DC/DC converter for obtaining Vpp. |
|
2.4. Target Processor Interface
|
|
The Voltage of target's MCLR is controlled
by RC0, RC1 and RC2 (all active low). When RC0 goes low, Vpp is enabled,
and RC1 low enables Vdd. RC2 pulls MCLR to GND on demand - this is
necessary if there is a pull-up resistor at the target's MCLR pin. |
| New Version using OpAmp |
|
Take a LM358 type OpAmp or similar. Because
of some voltage drop across the OpAmp, its supply (label Vpp) has to be
15V (or higher) now!! At the output of the OpAmp, there should be a
current limiting resistor (about 33-50Ohm) in case your OpAmp is capable
of delivering high output currents. The potentiometer is about 47KOhm and
allows to adjust the programming voltage over a wide range. You should
tweak it to about 13V (see Voltage Monitor at ICD's Status Dialog in
MPLAB!). Of course, for a fixed voltage two normal resistors can be used
instead of the poti, too. Since the programming voltage is generated only
on demand but the ICD firmware wants to be able to monitor it all the
time, we have to create some kind of fake voltage for RA3 (its ADC value
won't be a real existing voltage any more, but the firmware will think
it's in range): change the value of R13 to 4k7 and R14 to 6k8 and connect
R13 to Vdd instead of Vpp!! |
| Old Version using discrete transistors |
|
The two diodes should be germanium or
schottky type because of the lower voltage drop across them. The values of
resistors together with the defined limited current amplification of the
B-series transistors ensure that there will flow sufficient but not too
high currents into the MCLR-Pin so the target's PIC won't latch-up. |
|
|
|
|